<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>大卫杜夫 | 雪茄</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="shortcut icon" type="image/ico" href="http://davidoff.com/favicon.ico" />
	<link href="../static/lib/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
	<link rel="stylesheet" href="../static/dist/css/swiper.min.css">
	<link href="../static/css/reset.css" rel="stylesheet">
	<link href="../static/css/main.css" rel="stylesheet">
	<link href="../static/css/en.css" rel="stylesheet">
</head>

<body>
	<div id="header"></div>
		<div class="page_wrapper">
			<section id="page-toolbar" class="cigars" style="margin-bottom:10px">
				<a href="javascript:history.go(-1)" class="bread"><span>返回</span></a>
			</section>
			<!-- row start -->
			<div id="wp">
			</div>
			<script id="tpl" type="text/html">
				<section id="product" class="margin-bottom-80">
				<div id="visual">
							<!-- Swiper -->
					<div class="swiper-container gallery-top">
							<div class="swiper-wrapper">
									<%for(var i = 0; i< list.IMG_URL.length; i++) {%>
									<div class="swiper-slide"><img src="<%:=list.IMG_URL[i]%>"> </div>	
									<%}%>							
							</div>
							<!-- Add Arrows -->
						</div>
						<div class="swiper-container gallery-thumbs">
								<div class="swiper-wrapper">
										<%for(var j = 0; j < list.IMG_URL.length; j++) {%>
									<div class="swiper-slide"><img src="<%:=list.IMG_URL[j]%>"></div>
									<%}%>									
								</div>
							</div> 
								<!-- Swiper end -->
					<div class="cta-bar">					
						<ul id="social-links" class="clearfix">
							<li class="label">分享</li>
							<li class="icons">
								<div class="icons-wrapper">
									<a class="button popup icon external facebook" href="https://www.facebook.com/sharer/sharer.php?u=http://davidoff.com/cigars/primeros-dominican-nicaragua">
										<div class="icon" data-type="Facebook"></div>
									</a>
									<a class="button popup icon external twitter" href="http://twitter.com/intent/tweet?url=http://davidoff.com/cigars/primeros-dominican-nicaragua&amp;via=Davidoff_Cigars&amp;text=Primeros by Davidoff Nicaragua">
										<div class="icon" data-type="Twitter"></div>
									</a>
									<a class="button popup icon external pin" href="http://pinterest.com/pin/create/button/?url=http://davidoff.com/cigars/primeros-dominican-nicaragua&amp;media=http://davidoff.com/images/cigars/cig_prim_nicaragua_sgl.jpg"
									 style="text-decoration:none;">
										<div class="icon" data-type="Pinterest"></div>
									</a>
									<a class="button popup icon email" href="mailto:?subject=Davidoff.com - Primeros by Davidoff Nicaragua&amp;body=http://davidoff.com/cigars/primeros-dominican-nicaragua">
										<div class="icon" data-type="Email"></div>
									</a></div>
							</li>
						</ul>
					</div>
					</div>
				</div>
			</div>
				<!-- info start -->
				<div id="info">
						<h3 class="desktop"><%:=list.PD_TYPE_NAME%></h3>
						<h2 class="desktop"><%:=list.PRODUCT_NAME%></h2>
						<p class="body">
								<%:=list.PRODUCT_NAME%>
						</p>
						<div class="table-wrapper">
							<ul><%if(list.DIMENSIONS) {%>							
								<li class="filters pad">
									<div class="value"><%:=list.DIMENSIONS%></div>
									<div class="label">尺寸</div>
								</li>
								<%}%> 
								<%if(list.WEIGHTS) {%>	
									<li class="filters pad">
										<div class="value"><%:=list.WEIGHTS%></div>
										<div class="label">重量</div>
									</li>	
									<%}%> 	
									<%if(list.CAPACITY) {%>				
								<li class="filters pad">
									<div class="value"><%:=list.CAPACITY%></div>
									<div class="label">容量</div>
								</li>	
								<%}%> 	
								<%if(list.MATERIALS) {%>					
								<li class="filters materials pad">
									<div class="value" id="MATERIALS"><%:=MATERIALS%></div>
									<div class="label">材质</div>
								</li>
								<%}%> 	
								<%if(list.FINISH) {%>
								<li class="filters finish pad hide">
									<div class="value"><%:=list.FINISH%></div>
									<div class="label">工艺</div>
								</li>
								<%}%> 
								<%if(list.MADEIN) {%>							
								<li class="filters">
									<div class="value"><%:=list.MADEIN%></div>
									<div class="label">产地</div>
								</li>	
								<%}%> 						
							</ul>						
							<ul class="variations-list">
								<li class="filters variations">
									<div class="value" id="Cname"><%:=name%></div>
									<%var VARIATIONS=JSON.parse(list.VARIATIONS)%>
										<%if(VARIATIONS){%>
									<div class="swatch-wrapper">									
										<%for(var i = 0; i < VARIATIONS.length; i++) {%>
											<%if(VARIATIONS[i].VALUE!="") {%>												
											<%if(i==0) {%>
											<span class="swatch active" >
													<%}else{%>	
														<span class="swatch">		
												<%}%>
												<img src="<%:=VARIATIONS[i].VALUE%>" onclick="showName(<%:=i%>,this)"></span>									
												<%}%>
												<%}%>	
									</div>
									<div class="label">颜色</div>
															
									<%}%> 	
								</li>
							</ul>
							
						</div>
						<!-- info end -->
					<a href="../map/index.html" style="margin-top: 20px;" class="btn--gold js-trackProduct" data-product="Primeros by Davidoff Nicaragua"
					 data-action="Find a shop">临近店铺</a>
					<div class="cta-bar-mobile">
						<ul id="social-links" class="clearfix">
							<li class="label">Share</li>
							<li class="icons">
								<div class="icons-wrapper">
									<a class="button popup icon external facebook" href="https://www.facebook.com/sharer/sharer.php?u=http://davidoff.com/cigars/primeros-dominican-nicaragua">
										<div class="icon" data-type="Facebook"></div>
									</a>
									<a class="button popup icon external twitter" href="http://twitter.com/intent/tweet?url=http://davidoff.com/cigars/primeros-dominican-nicaragua&amp;via=Davidoff_Cigars&amp;text=Primeros by Davidoff Nicaragua">
										<div class="icon" data-type="Twitter"></div>
									</a>
									<a class="button popup icon external pin" href="http://pinterest.com/pin/create/button/?url=http://davidoff.com/cigars/primeros-dominican-nicaragua&amp;media=http://davidoff.com/images/cigars/cig_prim_nicaragua_sgl.jpg"
									 style="text-decoration:none;">
										<div class="icon" data-type="Pinterest"></div>
									</a>
									<a class="button popup icon email" href="mailto:?subject=Davidoff.com - Primeros by Davidoff Nicaragua&amp;body=http://davidoff.com/cigars/primeros-dominican-nicaragua">
										<div class="icon" data-type="Email"></div>
									</a></div>
							</li>
						</ul>
					</div>
				</div>
			</section>
			
		</script>
			<!-- 评分 -->
		<section id="reviews" class="margin-bottom-40">			
			<div id="score_wp">
			</div>
			<script id="score_tpl" type="text/html">
				<%if(scoreList.length>0) {%><header class="section-header margin-bottom-40">
				 <h2 class="caps">评分</h2>
				</header>
				<%}%> 
				<%for(var i = 0; i < scoreList.length; i++) {%>
				<div class="item score">
					<span class="number"><%:=scoreList[i].EVAL_SCORE%>
					</span>
					<p class="body"><%:=scoreList[i].EVAL_DETAIL%>
					</p>
					<a href="<%:=scoreList[i].EVAL_LINK%>" target="_blank"><span class="source">查看详情 ></span></a>				
				</div>
				<%}%>
			</script>
		</section>
		<!-- 您可能喜欢 -->
		<section id="related">			
			<div id="love_wp">
			</div>
			<!-- Related Accessories -->
			<script id="love_tpl" type="text/html">
				<%if(loveList.length>0) {%><header class="section-header margin-bottom-40">
				<h2 class="caps">您可能喜欢</h2>
				</header><%}%> 
				<%for(var j = 0; j < loveList.length; j++) {%>
				<%if(j==0) {%>
			<div class="item two">
					<%}%>
					<%if(j==1) {%>
						<div class="item one">
					<%}%>
					<%if(j==2) {%>
					<div class="item three">
					<%}%>
					<%if(loveList[j].BIG_CLASS=="配件") {%>	
				  <a href="/accessories/detail.html?PRODUCT_ID=<%:=loveList[j].PRODUCT_ID%>">
					<%}else{%>
					<a href="/cigars/detail.html?PRODUCT_ID=<%:=loveList[j].PRODUCT_ID%>">
					<%}%>
					<div class="image-wrapper"><img src="<%:=JSON.parse(loveList[j].IMG_URL)[0]%>"
						 alt="<%:=loveList[j].PRODUCT_NAME%>"></div>
					<h3><%:=loveList[j].PRODUCT_NAME%></h3>
				</a>
			</div>
			<%}%>
		</script>
		</section>
			<!-- row end -->
		</div>
		<!--footer start  -->
		<!--footer end  -->
		<div id="footer"></div>
		<script type="text/javascript" src="../static/lib/fancyBox-2.1.5/lib/jquery-1.10.1.min.js"></script>
		<script src="../static/lib/bootstrap/dist/js/bootstrap.min.js"></script>
		<script src="../static/js/common.js"></script>
		<script src="../static/js/template.js"></script>
		<!-- Swiper JS -->
		<script src="../static/dist/js/swiper.min.js"></script>
		<script>
			var varitions;
			var ProductInfo;

			function showScore() {
				var tpl = document.getElementById('score_tpl').innerHTML;
				ProductInfo.EVAL_DETAIL = JSON.parse(ProductInfo.EVAL_DETAIL)
				var html = template(tpl, {
					scoreList: ProductInfo.EVAL_DETAIL
				});
				document.getElementById('score_wp').innerHTML = html;
			}

			function showLovePrd() {
				var tpl = document.getElementById('love_tpl').innerHTML;
				ProductInfo.LOVE_PRODUCTS = JSON.parse(ProductInfo.LOVE_PRODUCTS)
				var html = template(tpl, {
					loveList: ProductInfo.LOVE_PRODUCTS
				});
				document.getElementById('love_wp').innerHTML = html;
			}

			function showName(idx, obj) {
				$("#MATERIALS").html(varitions[idx].MATERIALS);
				$("#Cname").html(varitions[idx].NAME);
				$(".swatch").removeClass("active");
				$(obj).parents(".swatch").addClass("active");
			}
			$(function () {
				let params = {
					"cmd": "product.get",
					"param": {
						"PRODUCT_ID": getUrlParam('PRODUCT_ID')
					}
				}
				$.ajax({
					type: "POST",
					url: "http://davidoff.gemdesign.cn/CMS/api/CMS",
					contentType: "application/json; charset=utf-8",
					data: JSON.stringify(params),
					dataType: "json",
					success: function (data) {
						ProductInfo = data.ProductInfo
						var tpl = document.getElementById('tpl').innerHTML;
						varitions = JSON.parse(ProductInfo.VARIATIONS)
						if (!varitions) {
							varitions = [];
						}
						var name = "";
						var MATERIALS = "";
						if (varitions.length > 0) {
							name = varitions[0].NAME;
							MATERIALS = varitions[0].MATERIALS;
						}
						ProductInfo.IMG_URL = JSON.parse(ProductInfo.IMG_URL)
						var html = template(tpl, {
							list: ProductInfo,
							name: name,
							MATERIALS: MATERIALS
						});
						document.getElementById('wp').innerHTML = html;
						//显示评分
						showScore()
						//显示关联产品
						showLovePrd()
						var galleryThumbs = new Swiper('.gallery-thumbs', {
							spaceBetween: 10,
							slidesPerView: 4,
							freeMode: true,
							watchSlidesVisibility: true,
							watchSlidesProgress: true,
						});
						var galleryTop = new Swiper('.gallery-top', {
							spaceBetween: 10,
							navigation: {
								nextEl: '.swiper-button-next',
								prevEl: '.swiper-button-prev',
							},
							thumbs: {
								swiper: galleryThumbs
							}
						});
						$("#btn_return").attr("href", "index.html?PD_TYPE_NAME=" + ProductInfo.PD_TYPE_NAME);
					},
					error: function (message) {
						alert(message)
					}
				});
			});

		</script>
</body>

</html>
